# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AuthorizedBuyersMarketplace.V1.Model.FinalizedDeal do
  @moduledoc """
  A finalized deal is a snapshot of the deal when both buyer and seller accept the deal. The buyer or seller can update the deal after it's been finalized and renegotiate on the deal targeting, terms and other fields, while at the same time the finalized snapshot of the deal can still be retrieved using this API. The finalized deal contains a copy of the deal as it existed when most recently finalized, as well as fields related to deal serving such as pause/resume status, RTB metrics, and more.

  ## Attributes

  *   `deal` (*type:* `GoogleApi.AuthorizedBuyersMarketplace.V1.Model.Deal.t`, *default:* `nil`) - A copy of the Deal made upon finalization. During renegotiation, this will reflect the last finalized deal before renegotiation was initiated.
  *   `dealPausingInfo` (*type:* `GoogleApi.AuthorizedBuyersMarketplace.V1.Model.DealPausingInfo.t`, *default:* `nil`) - Information related to deal pausing for the deal.
  *   `dealServingStatus` (*type:* `String.t`, *default:* `nil`) - Serving status of the deal.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The resource name of the finalized deal. Format: `buyers/{accountId}/finalizedDeals/{finalizedDealId}`
  *   `readyToServe` (*type:* `boolean()`, *default:* `nil`) - Whether the Programmatic Guaranteed deal is ready for serving.
  *   `rtbMetrics` (*type:* `GoogleApi.AuthorizedBuyersMarketplace.V1.Model.RtbMetrics.t`, *default:* `nil`) - Real-time bidding metrics for this deal.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :deal => GoogleApi.AuthorizedBuyersMarketplace.V1.Model.Deal.t() | nil,
          :dealPausingInfo =>
            GoogleApi.AuthorizedBuyersMarketplace.V1.Model.DealPausingInfo.t() | nil,
          :dealServingStatus => String.t() | nil,
          :name => String.t() | nil,
          :readyToServe => boolean() | nil,
          :rtbMetrics => GoogleApi.AuthorizedBuyersMarketplace.V1.Model.RtbMetrics.t() | nil
        }

  field(:deal, as: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.Deal)
  field(:dealPausingInfo, as: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.DealPausingInfo)
  field(:dealServingStatus)
  field(:name)
  field(:readyToServe)
  field(:rtbMetrics, as: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.RtbMetrics)
end

defimpl Poison.Decoder, for: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.FinalizedDeal do
  def decode(value, options) do
    GoogleApi.AuthorizedBuyersMarketplace.V1.Model.FinalizedDeal.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.FinalizedDeal do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
